package com.peoit.honeycomb.dto;

import org.springframework.util.StringUtils;

import com.peoit.honeycomb.domain.Information;

public class InformationDto extends BaseDto {
	private String title;
	private String informationIntro;
	private String content;
	private String picturePath;
	private String offset;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getPicturePath() {
		return picturePath;
	}

	public void setPicturePath(String picturePath) {
		this.picturePath = picturePath;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getInformationIntro() {
		return informationIntro;
	}

	public void setInformationIntro(String informationIntro) {
		this.informationIntro = informationIntro;
	}

	/**
	 * To Entity
	 * 
	 * @param dto
	 * @return
	 */
	public static Information toEntity(InformationDto dto) {
		Information information = new Information();
		if (!StringUtils.isEmpty(dto.getId())) {
			information.setId(dto.getId());
		}
		information.setTitle(dto.getTitle());
		information.setInformationIntro(dto.getInformationIntro());
		information.setPicturePath(dto.getPicturePath());
		information.setContent(dto.getContent());
		return information;
	}

	/**
	 * To Dto
	 * 
	 * @param information
	 * @return
	 */
	public static InformationDto toDto(Information information) {
		InformationDto dto = new InformationDto();
		dto.setId(information.getId());
		dto.setTitle(information.getTitle());
		dto.setContent(information.getContent());
		dto.setInformationIntro(information.getInformationIntro());
		dto.setPicturePath(information.getPicturePath());
		return dto;
	}

	public String getOffset() {
		return offset;
	}

	public void setOffset(String offset) {
		this.offset = offset;
	}

}
